<template>
  <div class="userAddCard">
    <!--个人信息-->
    <div class="userInfo">
      <el-row :span="24">
        <el-col :span="6">真实姓名</el-col>
        <el-col :span="18"><el-input v-model="user.bankAccount" placeholder="请输入真实姓名"></el-input></el-col>
      </el-row>
    </div>
    <!--infoMain-->
    <div class="infoMain">
      <el-row :span="24">
        <el-col :span="6">开户银行</el-col>
        <el-col :span="18" class="infoSelect">
          <el-input v-model="user.bankName" placeholder="请输入开户行"></el-input>
        </el-col>
      </el-row>
      <el-row :span="24">
        <el-col :span="6">银行卡号</el-col>
        <el-col :span="18"><el-input v-model="user.bankCardNo" placeholder="请输入银行卡号"></el-input></el-col>
      </el-row>
    </div>
    <el-row :span="24" class="prompt">提示：请确保姓名，身份证，银行卡开户人为同一人！</el-row>
    <!--确认-->
    <el-row :span="24" class="submit">
      <el-button type="success" @click.native="getSubmit()">确认添加</el-button>
    </el-row>
  </div>
</template>

<script type="text/ecmascript-6">
export default {
  data () {
    return {
      user: {
        bankCardNo: '',
        bankAccount: '',
        bankName: '',
        token: this.$store.state.token
      }
    }
  },
  methods: {
    getSubmit () {
      if (!this.user.bankCardNo) {
        this.$message({
          message: '请填写银行卡账号',
          type: 'error',
          duration: 1000,
          showClose: false
        })
      } else if (!this.user.bankName) {
        this.$message({
          message: '请填写开户行',
          type: 'error',
          duration: 1000,
          showClose: false
        })
      } else if (!this.user.bankAccount) {
        this.$message({
          message: '请填写姓名',
          type: 'error',
          duration: 1000,
          showClose: false
        })
      } else {
        this.$http.post('http://218.104.153.143:8089/numberone-auth/busiUser/addBankCard.shtml', this.user, {
          headers: {'Content-Type': 'application/x-www-form-urlencoded'},
          emulateJSON: true
        }).then((data) => {
          this.$message({
            message: '添加成功',
            type: 'success',
            duration: 1000,
            showClose: false
          })
          this.$router.push('/user/bankcard')
        }, (ne) => {
          this.$message({
            message: '添加失败',
            type: 'error',
            duration: 1000,
            showClose: false
          })
        })
      }
    }
  }
}
</script>

<style lang="scss" type="stylesheet/scss">
  .userAddCard{
    font-size: 14PX;
    background-color:#f5f3f3;
    height: 615px;
    text-align: left;
  .el-input__inner{
    border: none;
  }
  .userInfo,.infoMain{
    margin-bottom: 10px;
    background-color: #fff;
    .el-row{
      padding:0 15px;
      height: 40px;
      line-height: 40px;
      border-bottom: 1px solid #cec8c8;
      .infoSelect{
        display: flex;
        padding:0 10px;
        .infoSelectLeft{
          color: gray;
          font-size: 14px;
        }
        .infoSelectContent{
          flex:1;
        }
      }
    }
  }
  .prompt{
    padding:0 15px;
    color:red;
    font-size: 12px;
    font-weight: bold;
  }
  .submit{
    margin-top: 20px;
    padding: 0 15px;
  .el-button--success{
    width: 100%;
  }
  }
  }

</style>
